package com.changgou.goods.dao;

import com.changgou.goods.pojo.Brand;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BrandMapper extends Mapper<Brand> {
    //通过分类名称查询品牌列表
    @Select("SELECT t3.`name` FROM (SELECT id from  tb_category where `name`=#{categoryName}) t1 INNER JOIN tb_category_brand t2 ON t1.id = t2.category_id INNER JOIN tb_brand t3 ON t2.brand_id=t3.id")
    List<Map> findBrandListByCategoryName(@Param("categoryName")String categoryName);

}
